check if cycle is present in circular array